<html>
<head><meta charset="utf-8"><title>alternatives to rayon · t-compiler/wg-parallel-rustc · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/index.html">t-compiler/wg-parallel-rustc</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/alternatives.20to.20rayon.html">alternatives to rayon</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="181128263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/alternatives%20to%20rayon/near/181128263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/alternatives.20to.20rayon.html#181128263">(Nov 19 2019 at 16:23)</a>:</h4>
<p>We've discussed on and off the idea of not using rayon here but having our own, simpler scheduling strategy. What does that maybe look like?</p>



<a name="181134641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/alternatives%20to%20rayon/near/181134641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/alternatives.20to.20rayon.html#181134641">(Nov 19 2019 at 17:29)</a>:</h4>
<p>I think we'd still want a thread pool of some sort, since thread spawning is pretty expensive, though maybe it's not yet worth it. Then in the few locations we've already identified we'd want to do something like this I imagine, which would internally spawn up num_cpus - 1 threads and run as needed on them</p>
<div class="codehilite"><pre><span></span><span class="n">tcx</span><span class="p">.</span><span class="n">parallelize</span><span class="p">(</span><span class="o">&amp;</span><span class="n">some_vector</span><span class="p">,</span><span class="w"> </span><span class="o">|</span><span class="n">element</span><span class="o">|</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="c1">// ...</span>
<span class="p">});</span><span class="w"></span>
</pre></div>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>